package com.wangp.enjoywork.util;

import java.util.Calendar;
import java.util.Date;

public class TimeUtils {
	
	public static Date modifySignOnTime(Date date){
		Calendar cal =Calendar.getInstance();
		cal.setTime(date);
		//返回根据给定时间加上5天后的月份，修正每个月底的会签单中上船日期
		cal.add(Calendar.DAY_OF_MONTH, 5);
		
		int month = cal.get(Calendar.MONTH);
		System.out.println(month);
		
		return cal.getTime();
	}

	
	
	public static String formatSignOffCrewsOnTime(String time){
		String year = time.substring(time.length()-4);
		String month = "";
		switch(time.substring(time.length()-7,time.length()-4)){
			case "JAN":
				month = "01";
				break ;
			case "FEB":
				month = "02";
				break ;
			case "MAR":
				month = "03";
				break ;
			case "APR":
				month = "04";
				break ;
			case "MAY":
				month = "05";
				break ;
			case "JUN":
				month = "06";
				break ;
			case "JUL":
				month = "07";
				break ;
			case "AUG":
				month = "08";
				break ;
			case "SEP":
				month = "09";
				break ;
			case "OCT":
				month = "10";
				break ;
			case "NOV":
				month = "11";
				break ;
			case "DEC":
				month = "12";
				break ;
		}
		
		
		return year+"年"+ month + "月" ;
	}
	
	
}
